<?php
/**
 * Created by PhpStorm.
 * UsersF: Mloong
 * Date: 2019/2/28
 * Time: 14:34
 */

namespace app\api\validate;


class YzmValidate extends BaseValidate
{
    protected $rule = [
        'phone' => 'require|mobile',
    ];

    protected $message = [
        'phone.require' => '手机号码必须',
        'phone.mobile'     => '手机号码格式错误',
        'logo.require'     => '商户标识必须',
        'logo.number'     => '商户标识格式错误',
        'logo.length'     => '商户标识长度错误',
    ];

    # 检查logo是否存在
    protected function check_logo($value, $rule='', $data='', $field='')
    {
        $arr = config('logo.');
        foreach ($arr as $key=>$logo){
            if($key == $value){
                return true;
            }
        }
        return '商户号不存在';
    }
}